package com.xt.wikiperfumapi.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageInfo;
import com.github.pagehelper.page.PageMethod;
import com.xt.wikiperfumapi.model.PerfumeInfo;
import com.xt.wikiperfumapi.model.UserCollectPerfumeRef;
import com.xt.wikiperfumapi.model.vo.PerfumeVo;
import com.xt.wikiperfumapi.service.PerfumeInfoService;
import com.xt.wikiperfumapi.mapper.PerfumeInfoMapper;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.BeanUtils;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
* @author 24862
* @description 针对表【perfume_info】的数据库操作Service实现
* @createDate 2024-12-02 15:17:46
*/
@Service
@Slf4j
public class PerfumeInfoServiceImpl extends ServiceImpl<PerfumeInfoMapper, PerfumeInfo>
    implements PerfumeInfoService{


    @Resource
    PerfumeInfoMapper perfumeInfoMapper;


    /**
     * 模糊查询序列化
     *
     * @param page
     * @param item
     * @param brandId
     * @param sex
     * @param priceStart
     * @param priceEnd
     * @param name
     * @param fragranceNote
     * 排序只需要一个即可 用rank接收
     * @param rankUptime
     * @param rankBuy
     * @param rankPrice
     *
     * @return
     */
    @Override
    public PageInfo queryByPage(int page, int item, Long brandId, String sex, BigDecimal priceStart, BigDecimal priceEnd,
                                             String name, String fragranceNote, Long rankUptime, Long rankBuy, Long rankPrice) {
        PageMethod.startPage(page,item);
        List<PerfumeInfo> perfumeInfos = perfumeInfoMapper.selectByPram(brandId,
                sex,
                priceStart,
                priceEnd,
                name,
                fragranceNote,
                rankUptime ,
                rankBuy,
                rankPrice);
        return new PageInfo<>(perfumeInfos);
    }

}




